import { fetchListData } from './model';
import StudentList from './components/StudentList';
import TeacherList from './components/TeacherList';
import listHoc from './components/listHoc';

//利用高阶组件去包装组件
const StudentListHoc = listHoc(StudentList, fetchListData);
const TeacherListHoc = listHoc(TeacherList, fetchListData);

class App extends React.Component {
  render() {
    return (
      //给子组件传递它需要的field属性
      <div className="app">
        <StudentListHoc field="student"></StudentListHoc>
        <hr />
        <TeacherListHoc field="teacher"></TeacherListHoc>
      </div>
    );
  }
}

export default App;
